<template>
 <div v-if="modelValue">
  <hr>
  modelValue:{{ modelValue }}
  我是子组件
  <button @click="yc">隐藏</button>
  <br>
  <input type="text" :value="txt" @input="txtchange">
 </div>
</template>

<script setup>
import { ref,reactive } from 'vue'
const props=defineProps({
  modelValue:{
    type:Boolean,
  },
  txt:{
    type:String
  }
})
const emit=defineEmits(['update:modelValue','update:txt'])

const yc=()=>{
    emit('update:modelValue',false)
}
const txtchange=e=>{
  console.log(e.target.value)
  emit('update:txt',e.target.value)
}
</script>

<style lang='scss' scoped>

</style>
